
import BpmnValidator from "../bpmn-utils/BpmnValidator";

export function getValueByKey(element, key) {
  return element.businessObject[key];
}

export const setValueByKey = (element, key, value) => {
  const errorMsg = BpmnValidator[key](element.businessObject, value);

  if (errorMsg && errorMsg.length) {
    return catchError(errorMsg);
  }

  const modeling = getModeler.getModeling();


  modeling.updateProperties(element, {
    [`${key}`]: value
  });
}